package taweb.flex.air.fexBrowser.display3d
{
	import alternativa.engine3d.core.Object3D;
	import alternativa.engine3d.events.MouseEvent3D;
	import alternativa.engine3d.materials.FillMaterial;
	import alternativa.engine3d.materials.TextureMaterial;
	import alternativa.engine3d.primitives.Box;
	import alternativa.types.Texture;
	
	import flash.display.BitmapData;
	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	
	import mx.controls.Alert;
	
	public class DomainBox extends Box
	{
		private var objet3D:Array;
		private var colorCode:String;
		
		public function DomainBox(width:Number=100, length:Number=100, height:Number=100,colorCode:String="0x00000",widthSegments:uint=1, lengthSegments:uint=1, heightSegments:uint=1, reverse:Boolean=false, triangulate:Boolean=false)
		{
			super(width, length, height, widthSegments, lengthSegments, heightSegments, reverse, triangulate);
			
			this.colorCode=colorCode;
			objet3D = new Array();
			init();
		}
		
		private function init():void{
			appliqueTexture();
		}
		
		private function appliqueTexture():void{
			var color2:uint = uint(this.colorCode);
			this.cloneMaterialToAllSurfaces(new FillMaterial(color2));
		}
		
		public function ajouterLink(cube:LinkBox,x:int,y:int,z:int):void{
			this.addChild(cube);
			cube.x=x;
			cube.y=y;
			cube.z=z;
			objet3D.push(cube);
		}
		
		public function supprimerAllLink():void{
			while (objet3D.length!=0){
				objet3D.pop();
			}
		}
	}
}